/*
 * Copyright (C) 2020 Agrui
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef IPC_TYPE_H
#define IPC_TYPE_H

#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#endif

#define IPC_TYPE_RESPONSE       0
#define IPC_TYPE_INDICATION     1

#define IPC_STATE_CONNECTED     0
#define IPC_STATE_DISCONNECTED  1

typedef struct {
    int16_t transaction;
    int8_t serviceId;
    int8_t clientId;
    int16_t msgId;
    int16_t Reserved;
} IpcHeadInfo;


typedef struct {
    int32_t transaction;
    int8_t type;
    int8_t serviceId;
    int16_t msgId;
    int32_t resultCode;
    int32_t dataLen;
} IpcDataHeadInfo;


typedef struct {
    int16_t channelId;
    int16_t transaction;
    int8_t serviceId;
    int8_t clientId;
    int16_t msgId;
    void* serviceInfo;
} IpcTransaction;

typedef void (*ipcResultCallback)(int msgId, int result, void* data, int dataLen, void* userData);


#endif

